<?php

class AppController extends Controller {
        var $helpers=array('Html','Form','Javascript','Ajax','Time');
	//var $components = array('DebugKit.Toolbar')vvv;
	var $components = array('Session');
        
        
        
    // Check if they are logged in
    function authenticate()//con esta función obligo al usuario a validarse en el sistema
    {
        // Check if the session variable User exists, redirect to loginform if not
        if(!$this->Session->check('User'))
        {
            $this->redirect(array('controller' => 'users', 'action' => 'login'));
            exit();
        }
    }
 
    // Authenticate on every action, except the login form
    function afterFilter()
    {
        if( $this->action != 'login' )
        {
            $this->authenticate();
        }
    }
}
?>